<!--#include file="inc/conn.asp" -->
<!--#include file="inc/Function.asp" -->
<!--#include file="inc/pageClass.asp"-->
<%
CheckAdmin()
Dim txtSearch,  Rs, Sql, SearchType, SearchClass
txtSearch = Trim(checkstr(request("txtSearch")))
SearchType = Trim(request("SearchType"))
ShowOnline = Trim(request("ShowOnline"))


Select Case ShowOnline
    Case "1"
		sqlstr2="and  login_flag<>0"
		order="login_time desc"
    Case "2"
		sqlstr2="and  vip=1"
		order="login_time desc"
    Case "3"
		sqlstr2="and  login_tag='N'"
		order="login_time desc"
	Case else
        order="user_no desc"
End Select

Select Case SearchType
    Case "1"
				If txtSearch<>"" Then 
				sqlstr = sqlstr + "and (user_id = '"&txtSearch&"' or password = '"&txtSearch&"' or user_mail = '"&txtSearch&"' or regip = '"&txtSearch&"' or user_mac = '"&txtSearch&"' or user_hard = '"&txtSearch&"') "&sqlstr2
				 Else
					 sqlstr = sqlstr2
				 End If 
	Case Else
				 If txtSearch<>"" Then
				 sqlstr = sqlstr + "and (user_id like '%"&txtSearch&"%' or password like '%"&txtSearch&"%' or user_mail like '%"&txtSearch&"%' or reg_qq like '%"&txtSearch&"%' or regip like '%"&txtSearch&"%' or user_mac like '%"&txtSearch&"%' or user_hard like '%"&txtSearch&"%' or user_qq like '%"&txtSearch&"%' or realname like '%"&txtSearch&"%' or realcode like '%"&txtSearch&"%') "&sqlstr2
				 Else
					 sqlstr = sqlstr2
				 End If 
End Select

If txtSearch<>"" Or ShowOnline<>"" Then
   sql="select *  from user_profile where 1=1 "&sqlstr&" order by "&order
Else
  sql="select *  from user_profile order by "&order
End If


If Trim(request("ShowType"))<>"" Then 
session("ShowType")= Trim(request("ShowType"))
End If 

If Trim(request("ShowQQ"))<>"" Then 
session("ShowQQ")= Trim(request("ShowQQ"))
End If 
'response.write sql

  Set Rs = Server.CreateObject("ADODB.Recordset")
  Rs.Open sql,Conn,1,1
  Set page = New PageClass
    page.rs=Rs					'直接传递rs对象，传递成功后会自动关闭。如需要开启，请注释掉分页类的第87行val.Close。
    page.PageSize=Mypagesize					'分页大小
    page.setCount=-1					'可选。设置数据总数。0：使用RecordCount，-1：使用Count（默认），其他正数：指定的数据总数。字符串：获取数据总数的SQL。
    page.PageID="p"					'Request.QueryString中分页参数字符串

	strtitle=ServerName&"-用户列表"
	Call  head(strtitle)
If browser()="pc" Then Call  LeftMenu()

%>
      <!-- 右侧主体开始 -->
  <div class="page-content">
<%Call  mnav()%>
		<div class="weadmin-body">
			<div class="layui-row">			</div>
		<%Call  Search()%>



                        <div class="layui-card-body layui-table-body layui-table-main" style="margin-top:-13px">
                           <form class="layui-form layui-form-pane" action="Char_Edit.asp" name=form method="get">
							<table class="layui-table layui-form">
                                <thead>
                                  <tr>
                                    <th>用户名</th>
                                    <%If browser()="pc" Then%>
									<th>密码</th>
                                    <th> 
									<div class="layui-inline layui-show-xs-block" style="width: 100px">
									<select name="ShowQQ"  lay-filter="oneLeverChange">
								<option value="?ShowQQ=1" <%if session("ShowQQ")="1"  Or session("ShowType")="" then response.Write(" selected")%>>注册QQ</option>
								<option value="?ShowQQ=2" <%if session("ShowQQ")="2" then response.Write(" selected")%>>本机QQ</option>
								 <option value="?ShowQQ=3" <%if session("ShowQQ")="3"  then response.Write(" selected")%>>查看邮箱</option>
									</select></div></th>
                                    <th><div class="layui-inline layui-show-xs-block" style="width: 100px;"><select name="ShowType"  lay-filter="oneLeverChange">
        <option value="?ShowType=1" <%if session("ShowType")="1" Or session("ShowType")="" then response.Write("selected")%>>IP地址</option>
        <option value="?ShowType=2" <%if session("ShowType")="2" then response.Write(" selected")%>>MAC地址</option>
        <option value="?ShowType=3" <%if session("ShowType")="3" then response.Write(" selected")%>>物理地址</option>
      </select></div></th>
									<th><%if ShowOnline="3" then response.write "备注" else response.write "最后登陆时间" end if%></th>
									<%End If %>
									<th>充值/商城</th>
									<td>操作</th>
									</tr>
                                </thead></form>
                                <tbody>
								  <%
								  If page.eof Or page.bof Then 
								 response.write "<TR><th align=left colSpan=8 height=30>没有找到任何记录...</th></TR>"
								 Else
								 Do While Not page.EOF
								user_no=page("user_no")
								 %>
                                  <tr>
                                    <th style="height:26px;"><a title="<%=user_no%>"  href="User_Edit.asp?user_no=<%=user_no%>"><%If page("login_flag")=0 Then response.write page("user_id") Else response.write "<FONT COLOR=""#CC0000"">"&page("user_id")&"</FONT>"%>   </a>


                                    </th><%If browser()="pc" Then%>
                                    <th><a href="User_List.asp?txtSearch=<%=page("password")%>"><%=page("password")%></a></th>


                                    <th><%
	  If session("ShowQQ")="1" Then 
			 response.write  page("reg_qq")
	  elseIf session("ShowQQ")="2" Then 
			 response.write  page("user_qq")
		Else
			response.write  "<a href=""User_List.asp?txtSearch="&page("reg_qq")&""">"&page("reg_qq")&"</a>"
	  End If
	%></th>
                                    
         <th><%
		If session("ShowType")="" Then session("ShowType")="1"
	  Select Case session("ShowType")
		Case "1"
			  response.write "<a href=""User_List.asp?txtSearch="&page("regip")&""">"&cip(Int(Hexnumber(ShowHex(page("user_ip_addr")))))&"</a>"
		Case "2"
			 response.write  "<a href=""User_List.asp?txtSearch="&page("user_mac")&""">"&page("user_mac")&"</a>"
		Case "3"
		If Not IsNull(page("user_ip_addr")) Then 
			ip1=getHTTPPage(cip(Int(Hexnumber(ShowHex(page("user_ip_addr"))))))
		Else
			ip1="未获取"
		End If 
			 'response.write  "<a href=""User_List.asp?txtSearch="&cip(Int(Hexnumber(ShowHex(page("user_ip_addr")))))&""">"&ip1&"</a>"
			 response.write ip1
			 Case Else
			 response.write  "<a href=""User_List.asp?txtSearch="&page("user_mac")&""">"&page("user_mac")&"</a>"
	End Select
%>
</th> 

<th><%
	  if ShowOnline="3" then 
	  response.write page("UserNote")
	   else
      
		  if page("login_time")<>"" then 
		  login_time=Replace(page("login_time"),"2009-","")
		  login_time=Replace(login_time,"2011-","")
		  login_time=Replace(login_time,"2010-","")
		  If page("login_flag")=0 Then 
				response.write login_time
		else 
				If datediff("s", page("login_time") , now())>180 Then response.write "<FONT COLOR=""#CC0000"">"&login_time&"</FONT>"
		End If 
		end if 
		end if
		  %></th>
<%End If %>
<th><%
	      SET RS_count = Conn_p.Execute("select sum(amount),sum(gamecash) from PayLog where trade_status>0 and userid='"&page("user_no")&"'")
		  If RS_count(0)>0 or RS_count(1)>0 Then 
		  response.write RS_count(0)&"\"&RS_count(1)
		  RS_count.close
		  End If %></th>
<th  class="td-status"  style="width: 125px;">

<%	    
									If page("login_tag")<>"N" then
										response.write"<a onclick=""member_stop(this,'"&user_no&"')"" href=""javascript:;""  title=""正常""><span class=""layui-btn layui-btn-xs layui-btn-normal"">正常</span></a>"
									Else
										response.write"<a onclick=""member_stop(this,'"&user_no&"')"" href=""javascript:;""  title=""停用""><span class=""layui-btn layui-btn-xs layui-btn-danger"">停用</span></a>"
									End if
									%>&nbsp;
								<a  onclick= "member_kick(this,'<%=page("user_id")%>')"href="javascript:;"><button type="button" class="layui-btn layui-btn-xs ">踢人</button></a>&nbsp;
								<a  onclick= "member_fuck(this,'<%=page("user_id")%>')"href="javascript:;"><button type="button" class="layui-btn layui-btn-xs  layui-btn-warm">屏蔽</button></a>

                                    </th>
                                  </tr>
                                                                
<%
   page.MoveNext
	Loop
	End If 
		 %>
                                </tbody>
                          </table>
						  
                        </div>
                            <div class="page">
								<%
								If browser()="pc" Then
									Response.write page.Control(10,"{Ctrl} {State}")
								Else
									Response.write page.Control(5,"{Ctrl} {State}")
								End If
								%>&nbsp;执行时间 <%=Int(FormatNumber((Timer() - TimerStart) * 1000, 3))%> ms
                        </div>				
				</div>
                    </div>
                </div>

	<%
Set Rs = Nothing
Set page = Nothing
conn.Close
Set conn = Nothing
%>
</body>
<%Call  footer%>

 <script>
      layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var  form = layui.form;
      });

       /*用户-停用*/
      function member_stop(obj,id){
          layer.confirm('确认封停该用户吗？',function(index){

              if($(obj).attr('title')=='正常'){

                //发异步删除数据
				$.ajax({
				url: "User_Edit.asp?Action=Lock" ,
				data: {'user_no':id} ,
				type: "get" ,
				dataType:'json',
				success:function(data){
				if(data.status=='yes'){
				$(obj).attr('title','停用')
                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-danger').html('停用');
                //layer.msg('账号已停用!',{icon: 5,time:1000}); 
				layer.msg(data.msg,{icon: 5,time:1200}); 

				}else{
				 layer.msg('操作失败!',{icon:1,time:1200});
				}
				}
				})

              }else{

//发异步删除数据
				//layer.msg(id);
				$.ajax({
				url: "User_Edit.asp?Action=UnLock" ,
				data: {'user_no':id} ,
				type: "get" ,
				dataType:'json',
				success:function(data){
				if(data.status=='yes'){
				$(obj).attr('title','启用')
                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-danger').html('正常');
				layer.msg(data.msg,{icon: 5,time:1200}); 
				}else{
				 layer.msg('操作失败!',{icon:1,time:1200});
				}
				}
				})
              }
              
          });
      }


       /*踢人*/
      function member_kick(obj,id){
          layer.confirm('确认将该用户踢下线吗？？',function(index){
                //发异步删除数据
				$.ajax({
				url: "Black_List.asp?Action=Add&Mac=tmp&Hard=tmp&Ip=11&logoff=1" ,
				data: {'id':id} ,
				type: "get" ,
				dataType:'json',
				success:function(data){
				if(data.status=='yes'){
				layer.msg(data.msg,{icon: 5,time:1200}); 
				}else{
				 layer.msg('操作失败!',{icon:1,time:1200});
				}
				}
				})
          });
      }



	  
layui.use(['form'], function() {
  var form=layui.form;
   form.on('select(oneLeverChange)',
     function(data){    
	 	var val=data.value;
		console.info(val);
		window.location=val;
	});
 });
</script>      
</html>				
